package com.yxplearn.mybatisplus.mybatisplus_simple.pojo;


import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.yxplearn.mybatisplus.mybatisplus_simple.type_handler.SetTypeHandler;
import com.yxplearn.mybatisplus.mybatisplus_simple.type_handler.MapTypeHandler;

import java.util.Map;
import java.util.Set;

@TableName(value = "user", autoResultMap = true)
public class User {
    @TableId
    private Long id;
    private String name;
    private Integer age;
    private String email;
    @TableField(typeHandler = MapTypeHandler.class)
    private Map attr;


    @TableField(typeHandler = JacksonTypeHandler.class)
    private Map attrJson;

    @TableField(typeHandler = SetTypeHandler.class)
    private Set<Integer> setTest;
    @TableLogic
    /**
     * UPDATE user SET is_deleted=1 WHERE id IN ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ) AND is_deleted=0
     */
    private Integer isDeleted;


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Map getAttr() {
        return attr;
    }

    public void setAttr(Map attr) {
        this.attr = attr;
    }

    public Map getAttrJson() {
        return attrJson;
    }

    public void setAttrJson(Map attrJson) {
        this.attrJson = attrJson;
    }

    public Set<Integer> getSetTest() {
        return setTest;
    }

    public void setSetTest(Set<Integer> setTest) {
        this.setTest = setTest;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }


    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                ", email='" + email + '\'' +
                ", attr=" + attr +
                ", attrJson=" + attrJson +
                ", setTest=" + setTest +
                '}';
    }
}
